<!-- Page statistics and control buttons area -->
<div class="statsRow">
    <div class="wrapper statsItems">
        <div class="sItem usersStats">
            <h2><a title="" class="value"><?php echo $this->totalBalance . '$'; ?><span>Overall balance</span></a></h2>
            <div class="statsDetailed" id="s3">
                <div class="statsContent">
                    <div class="sElements">
                        <div class="sDisplay"><h4><?php echo round($this->advertisersBalance['balance'], 2) . '$'; ?> </h4><span>advertisers</span></div>
                        <div class="sDisplay"><h4><?php echo round($this->publishersBalance['balance'], 2) . '$'; ?></h4><span>publishers</span></div>
                        <div class="sDisplay"><h4>5373$</h4><span>system</span></div>
                    </div>
                    <span class="line"></span>
                    <div class="statsUpdate">
                        <span>Next update in:</span>
                        <span>10 hrs 55 min</span>
                        <div class="contentProgress"><div class="barG tipS" id="bar3" title="32%"></div></div>
                    </div>
                    <div class="statsDropBtn"><a href="#" class="button basic"><img src="/images/icons/dark/users.png" class="icon" alt="" /><span>View advertisers</span></a></div>
                </div>
            </div>
            <span class="changes">
                <span class="zeroBar" values="5,10,15,20,25,30,35,40,45,50"></span>
                <span class="zero">0.0%</span>
            </span>
        </div>
    </div>
</div>
<div class="line"></div>

<!-- Main content wrapper -->
<div class="wrapper">

    <table width=70% style="margin-right:auto; margin-left:auto; margin-top:20px;">
        <tbody>
            <tr>
                <td>
                    <div class="formRow" style="padding:0;">
                        <label>Starting date:</label>
                        <div class="formRight" style="float:none; margin-right:0; padding-top:5px; margin-left: 80px; width: 180px;">
                            <input type="text" class="datepicker" />
                        </div>
                    </div>
                </td>

                <td>
                    <div class="formRow" style="padding:0;">
                        <label>End date:</label>
                        <div class="formRight" style="float:none; margin-right:0; padding-top:5px; margin-left: 60px; width: 180px;">
                            <input type="text" class="datepicker" />
                        </div>
                    </div>
                </td>
                <td>
                    <a class="button greenB" style="margin: 5px;" title="" href="#"><span>построить график</span></a>
                </td>
            </tr>
        </tbody>
    </table>

    <div class="widget chartWrapper">
        <div class="title"><img src="/images/icons/dark/graph.png" alt="" class="titleIcon" /><h6>Lines chart</h6></div>
        <div class="body"><div class="chart"></div></div>
    </div>
    <a href="#" title="" class="button basic" style="margin: 5px;"><span>сохранить график в файл</span></a>
    <a href="#" title="" class="button basic" style="margin: 5px;"><span>распечатать</span></a>
    <a href="#" title="" class="button basic" style="margin: 5px;"><span>скачать отчет </span></a>

    <div class="line" style="margin-top:20px;"></div>

    <table style="margin-right:auto; margin-left:auto;">
        <tbody>
            <tr>
                <td>
                    <div class="formRow" style="padding:0;">
                        <label>Starting date:</label>
                        <div class="formRight" style="float:none; margin-right:0; padding-top:5px; margin-left: 80px; width: 180px;">
                            <input type="text" class="datepicker" />
                        </div>
                    </div>
                </td>

                <td>
                    <div class="formRow" style="padding:0;">
                        <label>End date:</label>
                        <div class="formRight" style="float:none; margin-right:0; padding-top:5px; margin-left: 60px; width: 180px;">
                            <input type="text" class="datepicker" />
                        </div>
                    </div>
                </td>
                <td style="text-align:left;">
                    <div class="formRow" style="margin-right:auto; margin-left:auto; width:200px;">
                        <div class="formRight" style="margin-right:0; width:200px;">
                            <select name="select2" >
                                <option value="opt1">по времени</option>
                                <option value="opt2">по публикаторам</option>
                                <option value="opt3">по рекламодателям</option>
                            </select>           
                        </div>
                        <div class="clear"></div>						
                    </div>
                </td>
                <td>
                    <a class="button greenB" style="margin: 5px;" title="" href="#"><span>построить таблицу</span></a>
                </td>
            </tr>
        </tbody>
    </table>

    <div class="widget">
        <div class="title"><img src="/images/icons/dark/full2.png" alt="" class="titleIcon" /><h6>если по времени</h6></div>
        <table cellpadding="0" cellspacing="0" border="0" class="display dTable">
            <thead>
                <tr>
                    <th>Дата</th>
                    <th>Общий оборот</th>
                    <th>Общий доход</th>
                    <th>Оборот за баннеры</th>
                    <th>Доход за баннеры</th>
                    <th>Оборот за контекстную рекламу</th>
                    <th>Доход за контекстную рекламу</th>
                    <th>Доход за рекламу в соц. сетях</th>
                    <th>Доход за рекламу в микроблогах</th>
                </tr>
            </thead>
            <tbody>
                <?php foreach ($this->turnover as $val) : ?>
                    <tr class="gradeA">
                        <td><?php echo date('d-m-Y', strtotime($val['date'])); ?></td>
                        <td><?php echo $val['sum']; ?>$</td>
                        <td>?</td>
                        <td><?php echo $val['banner_turnover'] != null?$val['banner_turnover']:0 ?>$</td>
                        <td>?</td>
                        <td><?php echo $val['context_turnover'] != null?$val['context_turnover']:0 ?>$</td>
                        <td>?</td>
                        <td>4653$</td>
                        <td>?</td>
                    </tr>
                <?php endforeach; ?>
            </tbody>
        </table>  
    </div>
    <div class="widget">
        <div class="title"><img src="/images/icons/dark/full2.png" alt="" class="titleIcon" /><h6>если по рекламодателям</h6></div>
        <table cellpadding="0" cellspacing="0" border="0" class="display dTable">
            <thead>
                <tr>
                    <th>Логин</th>
                    <th>Дата регистрации</th>
                    <th>Введено в систему</th>
                    <th>Расходов всего</th>
                    <th>Комиссий всего</th>
                    <th>Расходы на баннеры</th>
                    <th>Комиссий за баннеры</th>
                    <th>Расходы на контекст</th>
                    <th>Комиссий за контекст</th>
                    <th>Расходы на соц. сети</th>
                    <th>Расходы на микроблоги</th>
                    <th>Отчет</th>
                </tr>
            </thead>
            <tbody>
                <?php foreach ($this->allAdvertisers as $adv) { ?>
                    <?php if ($adv['id_status'] === '1') { ?>
                              <tr class="gradeA">
                    <?php } elseif ($adv['id_status'] === '2') { ?>        
                              <tr class="gradeC">
                    <?php } else { ?>
                              <tr class="gradeX">    
                    <?php } ?>              
                                <td><?php echo $adv['login']; ?></td>
                                <td><?php echo date('d-m-Y', strtotime($adv['date'])); ?></td>
                                <td><?php echo $adv['input'].'$'; ?></td>
                                <td><?php echo $adv['output'].'$'; ?></td>
                                <td>?</td>
                                <td><?php echo $adv['output_banners'].'$'; ?></td>
                                <td>?</td>
                                <td><?php echo $adv['output_context'].'$'; ?></td>
                                <td>?</td>
                                <td><?php echo $adv['output_social'].'$'; ?></td>
                                <td><?php echo $adv['output_blog'].'$'; ?></td>
                                <td><a href="#" title="">скачать</a></td>
                        </tr> 
                <?php } ?>
            </tbody>
        </table>  
    </div>

    <div class="widget">
        <div class="title"><img src="/images/icons/dark/full2.png" alt="" class="titleIcon" /><h6>если по публикаторам</h6></div>
        <table cellpadding="0" cellspacing="0" border="0" class="display dTable">
            <thead>
                <tr>
                    <th>Логин</th>
                    <th>Дата регистрации</th>
                    <th>Агент</th>
                    <th>Выведено всего</th>
                    <th>Доход всего</th>
                    <th>Доход за контекстную рекламу</th>
                    <th>Доход за баннерную рекламу</th>
                    <th>Отчет</th>
                </tr>
            </thead>
            <tbody>
                <?php foreach ($this->allPublishers as $pub) { ?>
                    <?php if ($pub['id_status'] === '1') { ?>
                              <tr class="gradeA">
                    <?php } elseif ($pub['id_status'] === '2') { ?>
                              <tr class="gradeC">    
                    <?php } else { ?>
                              <tr class="gradeX">    
                    <?php } ?>
                            <td><?php echo $pub['login']; ?></td>
                            <td><?php echo date('d-m-Y', strtotime($pub['date'])); ?></td>
                            <td><?php echo $pub['spec_status']; ?></td>
                            <td><?php echo $pub['output'].'$'; ?></td>
                            <td><?php echo $pub['input'].'$'; ?></td>
                            <td><?php echo $pub['context'].'$'; ?></td>
                            <td><?php echo $pub['banner'].'$'; ?></td>
                            <td><a href="#" title="">скачать</a></td>
                        </tr>              
                <?php } ?>
            </tbody>
        </table>  
    </div>

</div>